

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>基本设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/usercp/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/usercp/style/admin.css" media="all">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card" style="min-height: 500px;">
          <div class="layui-card-header">基本设置</div>
          <div class="layui-card-body" pad15>
            
            <div class="layui-form" wid100 lay-filter="">
              <div class="layui-form-item">
                <label class="layui-form-label">网站名称</label>
                <div class="layui-input-inline" style="width: 300px;">
                  <input type="text" name="name" value="{$info->name ?: ''}" placeholder="网站名称" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">请填写网站名称，用于显示在首页左上角</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">网站title</label>
                <div class="layui-input-inline" style="width: 300px;">
                  <input type="text" name="title" value="{$info->title ?: ''}" placeholder="网站title" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">请填写网站title，用于显示在浏览器标签上</div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="setting">确认设置</button>
                </div>
              </div>
            </div>
            
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="/usercp/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/usercp/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index']);


  layui.use(['form'], function(){
    var $ = layui.$
    ,layer = layui.layer
    ,form = layui.form;
    form.on('submit(setting)', function(obj){
      var field = obj.field;
      //ajax开始
      $.ajax({
        url: '/usercp/setting/setting',
        type: "POST",
        data: field,
        dataType: 'json',
        success: function(res) {
          if (res.code == 0){
            layer.msg(res.msg, {
              offset: '15px'
              ,icon: 2
              ,anim: 6
              ,time: 1000
            }, function(){});
            return false;
          }else{
            layer.msg(res.msg, {
              offset: '15px'
              ,icon: 1
              ,time: 1000
            }, function(){
              window.parent.location.reload();
            });
          }
          return false;
        }
      });
      return false;
      //ajax结束
    });
  })
  </script>
</body>
</html>